﻿using System;
using System.Runtime.InteropServices;
using UnityEngine;

[Serializable, StructLayout(LayoutKind.Sequential)]
public struct SerializableRect
{
    public float x;
    public float y;
    public float width;
    public float height;
    public SerializableRect(float X, float Y, float Width, float Height)
    {
        this.x = X;
        this.y = Y;
        this.width = Width;
        this.height = Height;
    }

    public static implicit operator Rect(SerializableRect v)
    {
        return new Rect(v.x, v.y, v.width, v.height);
    }

    public static implicit operator SerializableRect(Rect v)
    {
        return new SerializableRect(v.x, v.y, v.width, v.height);
    }
}

